Skip to content

fix(fields): a lookupFilters { $record } path through or to a multi-valued field is left out with a dev warning - #34618

Merged
objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34389-lookup-multi-valued-path
Nov 17, 2026
Merged

objectstack-fleet[bot] merged 5 commits into
mainfrom
claude/issue-34389-lookup-multi-valued-path

Conversation

@objectstack-fleet

Copy link
Copy Markdown
Contributor

Requested by Steve · project thread

Fixes #34389

Clause-②: no
Metadata-protocol: none

维护者速读

  • 改了什么:查找字段选择器遇到 lookupFilters 里 { $record } 路径经过或指向多值字段(多选关联、tags、关联行上的多值字段)时,不再把列表当标量发出,也不再静默丢弃;该条过滤一律不发,并在开发构建里告警一次,点名路径和多值字段。
  • 为什么改:以前直取多值字段会把整个列表塞进 eq 之类的标量比较,经多值关联跳转则悄悄丢掉,作者看不出过滤没生效;规格(lookupFilters { $record }: a path through or to a multi-valued field has no declared answer #34378 已合)写明这类路径不解析。
  • 风险与回滚:只影响写了多值 $record 路径的选择器(lint 本就拒收这种写法);单值路径、字面条目、dependsOn 行为不变。回滚即撤销本 PR。
  • 先看:ui/packages/fields/src/widgets/lookupRecordReference.ts 的 readRecordPath 三处 Array.isArray 守卫与 warnMultiValuedPath;再看测试文件新增的 describe。
  • 两分钟验证:pnpm --filter @object-ui/fields exec vitest run --root ../.. packages/fields/src/widgets/LookupField.recordReference-34197.test.tsx -t multi-valued,预期 4 个用例全绿(三种形状 + CONTROL)。
  • 需要你做的:无,席位落地。

What changes

readRecordPath (the picker's reader for a lookupFilters { $record } path) now treats a list found anywhere on the path as a multi-valued path:

  • a plain path to a multi-valued field (tags) — before: sent with the whole list as the comparand of a scalar operator;
  • a hop through a multiple: true lookup (accounts.cb_market) — before: left out silently (referencedId finds no id in a list, so neither a read nor the unreadable-hop warning happened);
  • a hop that ends at a multi-valued field of the hop's row (account.markets) — before: sent as a list.

In all three the entry is left out of the candidate query and a development build warns once per path, through the file's existing dev-warning channel (now warnLeftOut, shared with the unreadable-hop warning; production builds stay silent as before). The warning names the path, says it is multi-valued and names where the list sits (the field, or the lookup that holds a list of records).

The spec half (merged on main) says in LookupFilterRecordReferenceSchema's describe that such a path "has no single value: it is not resolved"; the picker now does exactly that. No packages/spec/** change.

Tests

New describe in the existing harness ui/packages/fields/src/widgets/LookupField.recordReference-34197.test.tsx (one shared harness per component): one case per shape (entry left out of the candidate query, warning given naming the path and the field) and a CONTROL (a single-valued field path and a single-valued one-hop path still resolve, no [LookupField] warning). No existing test was changed.

Package run, type-check and ablations (fix head 2a3ed4f; after the main merge to bc61296121 the card test file re-ran 16/16 on a rebuilt spec)
  • pnpm --filter '@object-ui/fields^...' build (dependency closure, under the verify lock): VERDICT command-exit 0.
  • @object-ui/fields pnpm run type-check (tsc --noEmit && tsc -p tsconfig.test.json; the test file is in the test program, counted with --listFiles): VERDICT command-exit 0.
  • @object-ui/fields pnpm test: Test Files 307 passed, 1 skipped (308); Tests 4649 passed, 7 skipped (4656); VERDICT command-exit 0.
  • Ablations through scripts/ablation-replace.mjs (fix committed first; each guard disabled alone as if (false && Array.isArray(...)), anchor 1 -> 0 on disk, restore proven blob == HEAD and git diff HEAD empty). The test imports ./LookupField from source, so no dist is involved:
    • plain-path guard off: "a plain path to a multi-valued field…" red; 1 failed, 3 passed.
    • hop-lookup guard off: "a hop through a multiple: true lookup…" red; 1 failed, 3 passed.
    • hop-end guard off: "a hop ending at a multi-valued field of the row…" red; 1 failed, 3 passed.
    • The CONTROL stayed green in all three.

Acceptance notes

  • Detection reads the VALUE (a list on the record or on the hop's row), not field metadata (isMultiValueField). The widget has no field map for the hop's target object, so a value read is the one signal available for all three shapes. Consequence: a multi-valued field that is currently null or unset is left out as an empty value without the multi-valued warning (the entry is still left out; os lint refuses the path at authoring time). An empty list [] now warns as multi-valued instead of being left out silently as empty.
  • The warning is said once per path per page load (module-level set, as the existing unreadable-hop warning already did).

Verification

Dispatch-gate derivation (node scripts/pm/dispatch-gates.mjs --commands --repo objectstack-ai/objectstack) run on the final head; every derived command run locally and reconciled with --ran. Families CI owns are read from this PR's check-runs.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC

…alued field is left out with a dev warning

A hop through a multiple: true lookup was dropped unsaid, and a plain path
to a multi-valued field sent its list as a scalar comparand. Both now leave
the entry out and warn once per path in a development build, the spec's
rule that such a path has no single value.

Claude-Session: https://claude.ai/code/session_01ADHkmSYVw1sqCsaHSJS9JC
Co-authored-by: Claude <noreply@anthropic.com>
@github-actions github-actions Bot added size/m documentation Improvements or additions to documentation tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface labels Nov 17, 2026
@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

Final head for L1 · 2026-11-17T03:55Z
Final head: bc6296121348a3907450e3c2412b1ee8280ec4d8 (card #34389, area o2-B). CI at this head: every check completed success or skipped by path filter (Lint & Repo Gates, TypeScript Type Check, Test Core, Lint UI, Type Check UI, Test UI 1–16/16 + aggregate, Build & E2E UI, Live E2E UI, Dogfood Regression Gate, Check Changeset, Check PR Size, PR-body guards, Governed Surface Queue Guard); none red.
Not governed (0 of 3 paths hit the register), 214 changed lines, nothing under packages/spec/**; Clause-②: no, Metadata-protocol: none: no L2 owed. The behaviour matches the merged spec describe for such a path ("has no single value: it is not resolved"). The dev's open question (value-based detection vs. a field-metadata leg) is answered A by the area: keep value-based detection; the entry is left out either way and lint refuses the authored path. L1 goes to the seat's L1-a thread, first review.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmQtnGcx7hYEL11ptVs

席位核对

L1 first review: ACCEPT · PR #34618 · card #34389 · area o2-B · L1-a2 · 2026-11-17T03:56Z

Head-sha: bc6296121348a3907450e3c2412b1ee8280ec4d8

Final-head comment 6937758551; dev report 6937737132.

Checklist

  • Shape. Draft, base main. The first line after the attribution block is Fixes #34389, the only closing keyword in the body. Fixes is right because the PR delivers the ui half the card asks for; the spec half (lookupFilters { $record }: a path through or to a multi-valued field has no declared answer #34378 → feat(lint)!: refuse a lookupFilters { $record } path through or to a multi-valued field #34489) is merged.
  • Scope (get_files, 3 paths): ui/packages/fields/src/widgets/lookupRecordReference.ts, its harness test LookupField.recordReference-34197.test.tsx, and .changeset/34389-lookup-record-path-multi-valued.md. No packages/spec/** and no unrelated files. The two main merges (0eb113f1, bc629612) have empty --remerge-diff, so neither has hand edits.
  • Code. readRecordPath gains three Array.isArray guards: on the plain path (record[path]), on the hop's lookup (record[via], before the empty check, so a multiple: true lookup is no longer left out silently), and on the hop's end value (row[field]). Each returns undefined through warnMultiValuedPath, so resolveLookupFilters leaves the entry out, the same as an empty value. The existing unreadable-hop warning moves onto the shared warnLeftOut with a hop: key, keeping its exact text, and the new warning uses a multi: key, so the two never suppress each other. The production guard is unchanged. Single-valued paths go through collapseReference as before.
  • Prior claims checked on origin/main. LookupFilterRecordReferenceSchema's describe (packages/spec/src/data/field.zod.ts:1371) reads "A path through or to a multi-valued field … has no single value: it is not resolved, and lint refuses it (object-field-ref-unknown)". The changeset's "The spec already states … and lint refuses it" is true.
  • Changeset (root .changeset/, @object-ui/fields patch, a published package). I checked each sentence against the diff: the three shapes, "left out … warns once per path … names the path and the field that holds a list", the two "Before" sentences (the silent hop, and the list sent as a scalar comparand), and "single-valued paths, literal entries and dependsOn … as before". All of them match. Clause-②: no and Metadata-protocol: none are consistent with a ui reader catching up to a merged spec rule.
  • Pins and ablations. One case per shape (entry absent from the candidate query, plus a warning naming the path and the field) and a CONTROL (a single-valued field and a one-hop path still resolve, no [LookupField] warning). Each guard was ablated alone through ablation-replace.mjs: each reds only its own shape (1 failed / 3 passed), the CONTROL stays green, and every file was restored to blob == HEAD. No existing test changed.
  • Accepted deviation: value-based detection (the area chose A). The widget has no field map for the hop's target object, so a list in the value is the one signal that covers all three shapes. The body states the consequences: an unset multi-valued field is left out as empty, without the multi-valued warning, and [] now warns as multi-valued. Both still leave the entry out, and os lint refuses the path when it is authored.
  • CI on this head (check-runs, filter=latest, 57 runs): success=44, skipped=13, nothing red or pending.

L2 and landing

  • L2: not owed. Clause-②: no, no narrowing, nothing under packages/spec/src/**, no governed text.
  • Landing tier (node scripts/pm/check-governed-merges.mjs --pr 34618): NOT governed — ordinary queue landing, 214 changed lines ≤ 3000, and not spec surface (no packages/spec/src/**). The area lands it. No human approval is needed.

@objectstack-fleet

Copy link
Copy Markdown
Contributor Author

repo:objectstack#2 · os-steve · session_01ADHkmSYVw1sqCsaHSJS9JC

Landing · 2026-11-17T03:57Z

probe reading
check-governed-merges.mjs --pr 34618 NOT governed, 0 of 3 paths hit the register; +191 / -23, under the 3000-line human-merge threshold; nothing under packages/spec/src
L1 at bc6296121348a3907450e3c2412b1ee8280ec4d8 ACCEPT (6937780751, first review, L1-a); no L2 owed; head unchanged since the final-head comment 6937758551

State change: ready for review + auto-merge, by area o2-B. #34389 closes through Fixes #34389 on merge.

@objectstack-fleet
objectstack-fleet Bot marked this pull request as ready for review November 17, 2026 03:57
@objectstack-fleet
objectstack-fleet Bot added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 518baca Nov 17, 2026
58 checks passed
@objectstack-fleet
objectstack-fleet Bot deleted the claude/issue-34389-lookup-multi-valued-path branch November 17, 2026 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation size/m tooling Fix lands in tooling, not a product package — enters pm:queue only with Unblocks: or a named surface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ui: a lookupFilters { $record } path through or to a multi-valued field is sent as a list (plain path) or silently dropped (hop) with no dev warning

2 participants